package com.example.lockfulldemo.controller;

import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author admin
 */
@Slf4j
@RestController
@RequestMapping("/security")
public class SecurityController {
    @GetMapping("/one")
    public String one() {
        return JSONUtil.toJsonStr(SecurityContextHolder.getContext().getAuthentication());
    }
    @GetMapping("/two")
    public String two() {
        return JSONUtil.toJsonStr(SecurityContextHolder.getContext().getAuthentication());
    }
    @GetMapping("/three")
    public String three() {
        return JSONUtil.toJsonStr(SecurityContextHolder.getContext().getAuthentication());
    }
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        String encode = encoder.encode("123");
        System.out.println(encode);

    }
}
